package com.yyp.dao.impl;

import java.io.Serializable;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.yyp.bean.CustomerInfo;
import com.yyp.bean.DeviceInfo;
import com.yyp.bean.ManagerInfo;
import com.yyp.dao.BaseDao;
import com.yyp.dao.DeviceInfoDao;
import com.yyp.dao.ManagerInfoDao;

@Service
@Transactional
public class DeviceInfoDaoImpl implements DeviceInfoDao  {
	@Resource
	BaseDao baseDaoImpl;

	/* (non-Javadoc)
	 * @see com.yyp.dao.impl.DeviceInfoDao#delete(java.io.Serializable)
	 */
	public void delete(Serializable names) {
		baseDaoImpl.delete(DeviceInfo.class, this.find((String)names).getIdeId());
	}
	/* (non-Javadoc)
	 * @see com.yyp.dao.impl.DeviceInfoDao#delete(java.lang.Integer)
	 */
	public void delete(Integer id) {
		baseDaoImpl.delete(DeviceInfo.class,id);
	}

	/* (non-Javadoc)
	 * @see com.yyp.dao.impl.DeviceInfoDao#find(java.lang.Integer)
	 */
	public DeviceInfo find(Integer id) {
		return baseDaoImpl.find(DeviceInfo.class, id);
	}

	/* (non-Javadoc)
	 * @see com.yyp.dao.impl.DeviceInfoDao#find(java.lang.String)
	 */
	public DeviceInfo find(String name) {
		String sql = "from DeviceInfo as m where m.ideNumId=?";
		String params[] = { name };
		return baseDaoImpl.find(sql, params);
	}

	/* (non-Javadoc)
	 * @see com.yyp.dao.impl.DeviceInfoDao#save(java.lang.Object)
	 */
	public void save(Object entity) {
		baseDaoImpl.save(entity);
	}

	/* (non-Javadoc)
	 * @see com.yyp.dao.impl.DeviceInfoDao#findAll()
	 */
	public List<DeviceInfo> findAll() {
		String sql = "from DeviceInfo";
		return baseDaoImpl.findAll(sql);
	}

	/* (non-Javadoc)
	 * @see com.yyp.dao.impl.DeviceInfoDao#updata(java.lang.Object)
	 */
	public void updata(Object entity) {

		baseDaoImpl.updata(entity);
	}

}
